package com.example.rabbitmq.controller;

import com.example.rabbitmq.config.Confirmconfig;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.connection.CorrelationData;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import sun.reflect.generics.tree.VoidDescriptor;
import sun.rmi.runtime.Log;

import javax.websocket.server.PathParam;

/**
 * @Date 2021/7/21 16:12
 * @Created by wangle
 * @Description
 */
@Slf4j
@RestController
@RequestMapping("/confirm")
public class Producecontroller {

    @Autowired
    RabbitTemplate rabbitTemplate;
    @RequestMapping("/sendmessage/{message}")
    public void  sendmessages(@PathVariable String message){

        CorrelationData correlationData=new CorrelationData("1");
        rabbitTemplate.convertAndSend(Confirmconfig.Confirm_exchangeName,Confirmconfig.routingkey+"11",message,correlationData);
        log.info("发消息内容为{}",message);

    }


}
